package voidgame.core;
import java.util.Random;

public class NameGenerator{
	
	
	
	public NameGenerator(){
		
		
		
	}
	
	public String[] astralList(int length){
		String[] list = new String[length];
		Random ran = new Random();
		final String[] start = {"Bo","Be","Co","Ca","Du","De","Fo","Fa","Ge","Ga","He","Hi","Io","Ja","Ju","Ki","Ka","La","Li","Me","Mo","Ni","No","Pa","Pe","Re","Ra","So","Su","Tu","Ti","Vi","Va","Wo","We","Ze","Zi"};
		final String[] mid = {"lara","rare","fali","benu","pedi","welu","hige","dire","stire","goru","rote","jola","pulu","cula","suli"};
		final String[] end = {"rae","lak","cia","ka","lo","la","s","te","gel","ri","wel","lt","re","f","r","ne"};
		
		int count=0;
		
		while(count<length){
			String candidate = start[ran.nextInt(start.length-1)];
			if(ran.nextInt(2)==0)
				candidate += mid[ran.nextInt(mid.length-1)];
			candidate += end[ran.nextInt(end.length-1)];

			if(!list.toString().contains(candidate)&&!candidate.equals("Sol")){
				//System.out.println(candidate+" "+candidate.equals("Sol"));
				list[count]=candidate;
				count++;
			}	
		}
		return list;		
	}
	
	
	public String[] lifeformNameList(int length){
		String[] res = new String[length];
		
		Random ran = new Random();
		
		String[] start = {"Gan", "Bol", "Mal", "Cil", "Dor", "Fum", "Hed", "Jal", "Kil", "Lil","Nor","Par","Rom","Sor","Tas","Vok"};
		String[] end = {"ite","ian","ad","od","an","on","il","un","esse","ar","or","er","id"};
		
		int count=0;
		
		while(count<length){
			String candidate = start[ran.nextInt(start.length-1)]+end[ran.nextInt(end.length-1)];
			
			if(!res.toString().contains(candidate)){
				res[count]=candidate;
				count++;
			}
		}
		return res;
	}
	
	
	public String lifeformName(Planet p){
		String res="";
		
		Random ran = new Random();
		
		String[] cend = {"ite","ian","ad","od","an","on","il","un","esse","ar","or","er","id"};
		String[] vend = {"d","n","t","n","t"};
		
		String ec = p.system.name.substring(p.system.name.length()-1);
		
		if(ec.equals("a")||ec.equals("e")||ec.equals("i")||ec.equals("o")||ec.equals("u"))
			res=p.system.name+vend[ran.nextInt(vend.length-1)];
		else
			res=p.system.name+cend[ran.nextInt(cend.length-1)];
	
		return res;
	}
	
	
	
}